#!/bin/bash -e
#health.sh is a script that watch the epg service's health status. by get pprof

ip=`ip -4 addr show eth0 | grep -oP "(?<=inet ).*(?=/)"`
output=$(wget -q -O - http://$ip:6060/debug/pprof | grep -oE '<td align=right>([0-9]+)<td><a href="([^?]+)' ) || exit $?
echo $output | sed "s/<td align=right>//g" |sed "s/<td><a href=\"/:/g" | sed "s/\([0-9]*\):\([a-z]*\)/\2:\1\n/g"
